perf: make methods synchronous in ObjectLifecycleService#4405
perf: make methods synchronous in ObjectLifecycleService#4405thomhurst merged 1 commit intothomhurst:mainfrom
ObjectLifecycleService#4405Conversation
be82e44 to
c2dbf02
Compare
SummaryThis PR optimizes ObjectLifecycleService by removing unnecessary async keywords and using ValueListBuilder for better performance in RegisterArgumentsAsync. Critical IssuesNone found ✅ SuggestionsConsider Task.WhenAll behavior on older .NET versionsIn RegisterArgumentsAsync, the fallback for pre-NET9 targets allocates a new array via .ToArray(), which reduces the performance benefit of using ValueListBuilder. However, this is only for older .NET targets where the span-based Task.WhenAll overload does not exist, so it is a reasonable trade-off. The NET9+ path gets the full benefit. Performance validationThe PR description shows allocation improvements in a screenshot. Since this touches a hot path (object registration), the performance improvement is welcome and aligns with TUnits Performance First principle. Previous Review StatusNo previous comments found. Verdict✅ APPROVE - No critical issues. The changes are clean, correct, and improve performance:
|
asynckeyword making methods synchronousValueListBuilderinRegisterArgumentsAsync, using the newerTask.WhenAll(ReadOnlySpan<Task>)overload where possible.Taskor create an array.Before
After